<html>
<head><meta charset="utf-8"><title>0 is not null in practice! · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/0.20is.20not.20null.20in.20practice!.html">0 is not null in practice!</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="156870391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/0%20is%20not%20null%20in%20practice%21/near/156870391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/0.20is.20not.20null.20in.20practice!.html#156870391">(Jan 25 2019 at 17:57)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/57897" target="_blank" title="https://github.com/rust-lang/rust/issues/57897">https://github.com/rust-lang/rust/issues/57897</a> outlines a practical instance of a previously very theoretical concern of pointer address of 0 not necessarily being a null pointer.</p>



<a name="156870403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/0%20is%20not%20null%20in%20practice%21/near/156870403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/0.20is.20not.20null.20in.20practice!.html#156870403">(Jan 25 2019 at 17:57)</a>:</h4>
<p>This should be pretty fun <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="156873800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/0%20is%20not%20null%20in%20practice%21/near/156873800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/0.20is.20not.20null.20in.20practice!.html#156873800">(Jan 25 2019 at 18:45)</a>:</h4>
<p>be afraid, be very afraid</p>



<a name="156927562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/0%20is%20not%20null%20in%20practice%21/near/156927562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/0.20is.20not.20null.20in.20practice!.html#156927562">(Jan 26 2019 at 14:31)</a>:</h4>
<p>Oh, I was actually aware of this issue; I thought other people were as well. Now I feel bad.</p>



<a name="156927612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/0%20is%20not%20null%20in%20practice%21/near/156927612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/0.20is.20not.20null.20in.20practice!.html#156927612">(Jan 26 2019 at 14:32)</a>:</h4>
<p><a href="https://stackoverflow.com/a/49020435/155423" target="_blank" title="https://stackoverflow.com/a/49020435/155423">https://stackoverflow.com/a/49020435/155423</a></p>
<div class="codehilite"><pre><span></span><span class="c1">// NULL is conventionally at address 0, so we &quot;use up&quot; the first 4</span>
<span class="c1">// bytes of address space to make our lives a bit simpler.</span>
<span class="n">base</span><span class="w"> </span><span class="o">+=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span><span class="w"></span>
</pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>